require("Interactor")

IntercectionWithValuesInteractor = class("IntercectionWithValuesInteractor", Interactor)

---

function IntercectionWithValuesInteractor:initialize(potentialExternalValues)

	Interactor.initialize(self)
	
	self.potentialExternalValues = potentialExternalValues
end

---

function IntercectionWithValuesInteractor:decohere(sourcePropertyValueSet)

	local intercection = {}
	
	for sourcePropertyValue, probability in pairs(sourcePropertyValueSet)
	do			
		for key, potentialExternalValue in pairs(self.potentialExternalValues)
		do
			if sourcePropertyValue == potentialExternalValue
			then
				intercection[sourcePropertyValue] = probability
			end
		end
	end
					
	return intercection
end